function e = plugin_bayes(ds1,ds2,T,m1,s1,m2,s2,P1,P2)
p1_1 = mvnpdf(ds1,m1,s1);
p2_1 = mvnpdf(ds1,m2,s2);
ne1 = sum(log(p1_1./p2_1) < T);

p1_2 = mvnpdf(ds2,m1,s1);
p2_2 = mvnpdf(ds2,m2,s2);
ne2 = sum(log(p1_2./p2_2) > T);

e = ne1 * P1 / size(ds1,1) + ne2 * P2 / size(ds2,1);
end